/**
 * auther : sgxiaoster@gmail.com
 * simple composite generator
 * 2010-04-05
 */

#include<stdio.h>
#include<string.h>

#define TRUE 1
#define FALSE 0

int main(int argc, char ** argv)
{
	unsigned int num;
	unsigned int i, j;
	unsigned count;
	int flag = TRUE;

	if( argv[1] )
		num = (unsigned int)atoi(argv[1]);
	/* printf("num = %u\n", num); */
	for( i=2; i<=num; i++) {
		flag = FALSE;
		for( j=2; j<i; j++) {
			if( i % j == 0 && i != j) {
				flag = TRUE;
				goto getout;
			}
		}
		getout :
		if(flag) {
			count % 10 == 0 ? 
				printf("%u,\n", i) :
				printf("%u,", i);
			count++;
		}
	}

	return 0;
}
